#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 crane <crane@his-pc>
#
# Distributed under terms of the MIT license.

"""

"""


class Solution:
    def compareStrings(self, A, B):
        # The characters in string A and B are all Upper Case letters.
        # 直接使用array
        count = [0] * 26
        for i in A:
            to_num = ord(i) - ord('A')
            count[to_num] += 1

        for i in B:
            to_num = ord(i) - ord('A')
            count[to_num] -= 1
            if count[to_num] < 0:
                return False

        return True


def main():
    print("start main")
    s = Solution()
    ret = s.compareStrings('ABCD', 'ABD')
    print(ret)

if __name__ == "__main__":
    main()
